package com.youlu.campus.web.community.controller;

import com.youlu.campus.entity.enums.TaskBizType;
import com.youlu.campus.service.activity.ActivityTaskService;
import com.yuelin.infrastructure.quantum.common.QResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

@RestController
public class ActivityTaskInfoController {
    @Autowired
    private ActivityTaskService activityTaskService;

    /**
     * 获取任务详情
     *
     * @param id 任务ID
     * @return 任务详情信息
     */
    @GetMapping("/mini-app/activity/task")
    public QResult getActivityTask(@RequestParam("id") @NotNull String id) {
        return QResult.success(activityTaskService.findOne(id));
    }

    /**
     * 获取任务详情（按类型）
     *
     * @param id          任务ID
     * @param taskBizType 任务业务类型
     * @return 对应类型的任务详情
     */
    @GetMapping("/mini-app/activity/task-type")
    public QResult getActivityTaskByType(@RequestParam("id") @NotNull String id,
                                         @RequestParam("type") @NotNull TaskBizType taskBizType) {
        return QResult.success(activityTaskService.find(id, taskBizType));
    }
}